package com.zb.daoimpl;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

import com.zb.dao.BaseDao;
import com.zb.dao.StoreDao;
import com.zb.entity.Store;

public class StoreDaoImpl implements StoreDao{
	private BaseDao db=new BaseDao();
	public List<Store> getStoreList() {
		List<Store>list=new ArrayList<Store>();
		String sql="select*from store";
		ResultSet rs=db.query(sql);
		try {
			while(rs.next()) {
				Store s=new Store();
				s.setId(rs.getInt(1));
				s.setStoreName(rs.getString(2));
				s.setStoreTel(rs.getString(3));
				s.setStoreAddress(rs.getString(4));
				s.setStoreLevel(rs.getInt(5));
				s.setStoreImg(rs.getString(6));
				list.add(s);
				return list;
			}
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}finally {
			db.close();
		}
		return null;
	}

}
